
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
  <title>用户添加</title>
  <script src="${pageContext.request.contextPath}/scripts/jquery-1.11.2.min.js"></script>
  <script>
    $(function(){
      $("#btn1").click(function(){
          var pass1 = $("#password").val();
          var pass2 = $("#confirm").val();
          if(pass1 === pass2){
              $("#tip").html("<h1>两次输入的密码不相同</h1>")
              return true;
          }
          else
          {
              return false;
          }
      });
    })
  </script>
</head>
<body>
<div id="tip"></div>
<form action="${pageContext.request.contextPath}/user_add" method="post">
  用户名:<input type="text" name="username"><br>
  密码：<input type="password" name="password" id="password"><br>
  确认密码：<input type="password" id="confirm"><br>
  昵称：<input type="text" name="nickname"><br>
  Email:<input type="email" name="email"><br>
  选择部门:
  <select name="departmentId">
    <option ${id==null?"selected":""} value="">请选择部门</option>
    <s:iterator value="#departments">
      <option name="departmentId" value="${id}">
          ${name}
      </option>
    </s:iterator>
  </select>
  选择角色：
  <select multiple name="roleIds">
    <s:iterator value="#roles">
      <option name="roleIds" value="${id}">
          ${name}
      </option>
    </s:iterator>
  </select>
  <button type="submit" id="btn1">提交</button>
</form>
</body>
</html>
